﻿using Sustainalytics.LongRunningTaskManager.Interface;
using System.Collections.Generic;

namespace Sustainalytics.LongRunningTaskManager
{
    public class LongRunningTaskS3FileResult : ILongRunningTaskResult, IEqualityComparer<LongRunningTaskS3FileResult>
    {

        public LongRunningTaskResultTypeEnum Type { get { return LongRunningTaskResultTypeEnum.S3File; } }

        public string Bucket { get; set; }

        public string FileName { get; set; }

        public string Key { get; set; }

        /// <summary>
        /// MIME Type.
        /// </summary>
        public string MimeType { get; set; }

        public bool Equals(ILongRunningTaskResult x, ILongRunningTaskResult y)
        {
            if (x == null && y == null)
                return true;

            if (x == null || y == null)
                return false;

            if (x.GetType() != typeof(LongRunningTaskS3FileResult) || x.GetType() != y.GetType())
                return false;

            return this.Equals((LongRunningTaskS3FileResult)x, (LongRunningTaskS3FileResult)y);
        }

        public int GetHashCode(ILongRunningTaskResult obj)
        {
            return this.GetHashCode(obj);
        }

        public bool Equals(LongRunningTaskS3FileResult x, LongRunningTaskS3FileResult y)
        {
            if (x == null && y == null)
                return true;

            if (x == null || y == null)
                return false;

            return (x.Bucket == y.Bucket) && (x.FileName == y.FileName) && (x.Key == y.Key) && (x.MimeType == y.MimeType);
        }

        public int GetHashCode(LongRunningTaskS3FileResult obj)
        {
            return 0;
        }
    }
}
